//
//  UIButton+Extension.swift
//  Demo-04-TabBarTest
//
//  Created by 苏统世 on 16/5/17.
//  Copyright © 2016年 SuTon. All rights reserved.
//

import UIKit

extension UIButton{
    
    
    convenience init(title:String,titleColor:UIColor=UIColor.lightGrayColor(), fontSize: CGFloat = 12,imageName:String,backgroundImageName:String){
        self.init(type:UIButtonType.Custom)
        
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(titleColor, forState: UIControlState.Normal)
        self.titleLabel?.font=UIFont.systemFontOfSize(fontSize)
        self.setBackgroundImage(UIImage(named: backgroundImageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: "\(backgroundImageName)_highlighted"), forState: UIControlState.Highlighted)
        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
    }
    
    
    
    
    
    
}

